Skip to content

feat(sdk-playground): interactive SDK chat playground - #1437

Merged
graphite-app[bot] merged 1 commit into
mainfrom
feat/sdk-playground
Sep 1, 2026
Merged

feat(sdk-playground): interactive SDK chat playground#1437
graphite-app[bot] merged 1 commit into
mainfrom
feat/sdk-playground

Conversation

@Dhravya

@Dhravya Dhravya commented Aug 8, 2026

Copy link
Copy Markdown
Member

Summary

  • Add apps/sdk-playground — chat UI to test TS/Python SDK integrations
  • Context panel with document memories, API keys in dashboard, tools reference tab
  • Python FastAPI server on port 8792; portless entry in portless.json

Stacked on #1436

Test plan

  • cd apps/sdk-playground && bun run check-types
  • bun run dev with Supermemory + OpenAI keys in UI
  • Switch SDKs and verify chat + context panel

Made with Cursor

@claude

claude Bot commented Aug 8, 2026

Copy link
Copy Markdown

Claude encountered an error —— View job


I'll analyze this and get back to you.

@cloudflare-workers-and-pages

cloudflare-workers-and-pages Bot commented Aug 8, 2026

Copy link
Copy Markdown

Deploying with  Cloudflare Workers  Cloudflare Workers

The latest updates on your project. Learn more about integrating Git with Workers.

Status Name Latest Commit Updated (UTC)
✅ Deployment successful!
View logs
supermemory-mcp b01d2b6 Sep 01 2026, 06:19 AM

@cloudflare-workers-and-pages

cloudflare-workers-and-pages Bot commented Aug 8, 2026

Copy link
Copy Markdown

Deploying with  Cloudflare Workers  Cloudflare Workers

The latest updates on your project. Learn more about integrating Git with Workers.

Status Name Latest Commit Preview URL Updated (UTC)
✅ Deployment successful!
View logs
supermemory-app b01d2b6 Commit Preview URL

Branch Preview URL
Sep 01 2026, 06:20 AM

@socket-security

socket-security Bot commented Aug 8, 2026

Copy link
Copy Markdown

@cursor cursor Bot left a comment

Copy link
Copy Markdown

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Cursor Bugbot has reviewed your changes using default effort and found 3 potential issues.

Fix All in Cursor

❌ Bugbot Autofix is OFF. To automatically fix reported issues with cloud agents, enable autofix in the Cursor dashboard.

Reviewed by Cursor Bugbot for commit 93f92cd. Configure here.

},
{ status: 400 },
)
}

Copy link
Copy Markdown

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Context API needs OpenAI key

Medium Severity

The context routes use resolveApiKeys, which returns null unless both Supermemory and OpenAI keys are present. Loading container context only calls Supermemory, and the context panel only validates the Supermemory key, so a dashboard with just a Supermemory key still gets a 400 from /api/context.

Additional Locations (1)
Fix in Cursor Fix in Web

Reviewed by Cursor Bugbot for commit 93f92cd. Configure here.

Comment thread apps/sdk-playground/src/lib/api-keys.ts Outdated
} else {
delete process.env.OPENAI_API_KEY
}
}

Copy link
Copy Markdown

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Shared env keys race

Medium Severity

Chat handlers temporarily overwrite global SUPERMEMORY_API_KEY and OPENAI_API_KEY on the shared Node process and Python process. Overlapping requests with different dashboard keys can read or write the wrong credentials mid-flight.

Additional Locations (1)
Fix in Cursor Fix in Web

Reviewed by Cursor Bugbot for commit 93f92cd. Configure here.

skipMemoryOnError: middlewareConfig.skipMemoryOnError,
},
keys.supermemoryApiKey,
)

Copy link
Copy Markdown

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Debug shows post-chat profile

Low Severity

Middleware memory debug is built by fetching profile after the model response (and after auto-save). The “Context injected into prompt” preview can include memories written in that same turn, not what middleware actually injected.

Additional Locations (1)
Fix in Cursor Fix in Web

Reviewed by Cursor Bugbot for commit 93f92cd. Configure here.

@claude claude Bot left a comment

Copy link
Copy Markdown

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Overview: Adds a new SDK playground app with Next.js frontend and Python FastAPI backend for interactively testing Supermemory SDK integrations across TypeScript and Python.

Issues found: None — this looks good to ship.

I reviewed ~4000 lines of new code across 26 files including:

  • Next.js API routes (/api/chat, /api/context)
  • Python FastAPI server with multiple SDK integration handlers
  • Frontend components (chat UI, API keys panel, context panel)
  • Core business logic (chat-handlers.ts, context-api.ts, api-keys.ts)

Design choices appropriate for a dev playground:

  • API keys in localStorage with clear user messaging
  • Permissive CORS on Python server (allow_origins=["*"])
  • Temporary env var manipulation for SDK compatibility

Code quality observations:

  • Good error handling throughout both TypeScript and Python
  • Proper API key resolution chain (user input → env vars)
  • Clean SDK abstraction via registry pattern
  • Tool loop limits prevent runaway execution (8 steps max)

Score: 9/10

Minor deduction for documentation mismatch (README says port 8791, env example says 8792) — not a blocker.

Dhravya commented Aug 8, 2026

Copy link
Copy Markdown
Member Author

@claude claude Bot left a comment

Copy link
Copy Markdown

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Overview: Adds an SDK playground app with Next.js frontend and Python FastAPI backend for interactively testing Supermemory SDK integrations across TypeScript and Python.

Issues found: None — this looks good to ship.

I reviewed ~5000 lines of new code across 29 files including:

  • Next.js API routes (/api/chat, /api/context) with proper request validation
  • Python FastAPI server with multiple SDK integration handlers
  • Frontend components (chat UI, API keys panel, context panel)
  • Core business logic (chat-handlers.ts, context-api.ts, request-validation.ts)
  • CI workflow additions for Python validation

Previous review issues addressed:
The latest commit (4e04a0d) fixes the two substantive issues from the earlier Cursor Bugbot review:

  • ✅ Context API no longer requires OpenAI key (now uses resolveSupermemoryApiKey)
  • ✅ API keys are passed directly to SDK clients, eliminating the env-var race condition

Security measures in place:

  • TrustedHostMiddleware restricts Python server to localhost only
  • assertTrustedBrowserRequest validates request origin and rejects cross-site requests
  • mayUseEnvironmentKeys restricts env-key usage to trusted hosts (localhost, sdk.dev.supermemory.ai)
  • Comprehensive input validation with length limits, pattern matching, and body size checks
  • SecretStr used for API keys in Python Pydantic models
  • API keys stored in sessionStorage (not localStorage), scoped to tab lifetime

Design choices appropriate for a dev playground:

  • Permissive CORS on Python server (localhost-only anyway)
  • 8-step tool loop limit prevents runaway execution
  • Proper timeout handling with best-effort debug info collection

Score: 9/10

Minor deduction for documentation mismatch (README mentions port 8791 in one place, env example says 8792) — not a blocker.

ved015
ved015 previously approved these changes Aug 24, 2026
@graphite-app

graphite-app Bot commented Sep 1, 2026

Copy link
Copy Markdown

Merge activity

@Dhravya
Dhravya force-pushed the feat/sdk-playground branch from 8a78b11 to e1c3122 Compare September 1, 2026 05:58
@Dhravya
Dhravya changed the base branch from graphite-base/1437 to chore/ci-js-tools-unit-tests September 1, 2026 05:58
@graphite-app
graphite-app Bot force-pushed the chore/ci-js-tools-unit-tests branch from d51641c to 05c4fb6 Compare September 1, 2026 06:02
graphite-app Bot pushed a commit that referenced this pull request Sep 1, 2026
## Summary
- Add `apps/sdk-playground` — chat UI to test TS/Python SDK integrations
- Context panel with document memories, API keys in dashboard, tools reference tab
- Python FastAPI server on port 8792; portless entry in `portless.json`

Stacked on #1436

## Test plan
- [ ] `cd apps/sdk-playground && bun run check-types`
- [ ] `bun run dev` with Supermemory + OpenAI keys in UI
- [ ] Switch SDKs and verify chat + context panel

Made with [Cursor](https://cursor.com)
@graphite-app
graphite-app Bot force-pushed the feat/sdk-playground branch from e1c3122 to ff2d0cf Compare September 1, 2026 06:02
## Summary
- Add `apps/sdk-playground` — chat UI to test TS/Python SDK integrations
- Context panel with document memories, API keys in dashboard, tools reference tab
- Python FastAPI server on port 8792; portless entry in `portless.json`

Stacked on #1436

## Test plan
- [ ] `cd apps/sdk-playground && bun run check-types`
- [ ] `bun run dev` with Supermemory + OpenAI keys in UI
- [ ] Switch SDKs and verify chat + context panel

Made with [Cursor](https://cursor.com)
@graphite-app
graphite-app Bot force-pushed the chore/ci-js-tools-unit-tests branch from 05c4fb6 to 7974498 Compare September 1, 2026 06:11
@graphite-app
graphite-app Bot force-pushed the feat/sdk-playground branch from ff2d0cf to b01d2b6 Compare September 1, 2026 06:12
@graphite-app
graphite-app Bot changed the base branch from chore/ci-js-tools-unit-tests to main September 1, 2026 06:18
@graphite-app
graphite-app Bot dismissed ved015’s stale review September 1, 2026 06:18

The base branch was changed.

@graphite-app
graphite-app Bot merged commit b01d2b6 into main Sep 1, 2026
5 of 7 checks passed
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants